import { createApp } from 'vue'
import App from './App.vue'
import axios from './http'
import useMessage from './composables/message'
import components from './components'
import router from './router'

// element plus
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'

// 导入所有图标并进行全局注册
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 全部注册Vant组件
import Vant, { Lazyload } from 'vant'
import 'vant/lib/index.css'

import '@/styles/index.scss'
import './assets/iconfont'
import './assets/iconfont.css'

const app = createApp(App)
app.use(ElementPlus, {
  locale: zhCn
})
app.use(Vant)
app.use(Lazyload, {
  lazyComponent: true
})
app.config.globalProperties.$message = useMessage()
app.config.globalProperties.$axios = axios
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(components)
app.use(router)
app.mount('#app')
